#include <bits/stdc++.h>

using namespace std;

#define int long long

void solve()
{
    int n; cin >> n;
    for(int i = 2;i <= n;i ++) cout << i << " ";
    cout << 1 << endl;
}
signed main()
{
    int t; cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}
